package ar.com.globallogic.promomr.domain;

import org.codehaus.jackson.annotate.JsonSubTypes;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import org.codehaus.jackson.annotate.JsonSubTypes.Type;
import org.springframework.data.annotation.Id;

@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type")
@JsonSubTypes({ 
		@Type(value=ar.com.globallogic.promomr.domain.Image.class, name="Image"),
		@Type(value=ar.com.globallogic.promomr.domain.Video.class, name="Video"),
		@Type(value=ar.com.globallogic.promomr.domain.Document.class, name="Document"),
		@Type(value=ar.com.globallogic.promomr.domain.Folder.class, name="Folder")})
public abstract class Node {
	
	@Id
	private String id;
	private String name;
	private String parentId;
	
	protected Node(){
		this.parentId = null;
	}
		
	protected Node(String name){
		this.name = name;
		this.parentId = null;
	}
		
	public boolean isRoot(){
		return this.parentId == null;
	}
		
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getParentId() {
		return parentId;
	}
	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
	
}
